/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package komenskyimagelinksfixer;

import cz.mzk.kramerius.fedoraaccess.FedoraConnector;
import cz.mzk.kramerius.fedoraaccess.FedoraServer;
import cz.mzk.kramerius.fedoraaccess.rest.RESTConnector;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Martin Řehánek <rehan at mzk.cz>
 */
public class Main {

    private static final String usage = "Usage: java -jar KomenskyImageLinksFixer.jar PROPERTIES_FILE TOP_LEVEL_PID";

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws InterruptedException {
        try {
            if (args.length != 2) {
                System.err.println(usage);
                return;
            }
            File properties = new File(args[0]);
            FedoraConnector conn = new RESTConnector(new FedoraServer(properties));
            String topLevelPid = args[1];
            KomenskyFixer fixer = new KomenskyFixer(conn, topLevelPid);
            fixer.run();
        } catch (IOException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
